{include file="public/header"}
{include file="public:user_top_nav"/}
<div class="layui-container ucenter  ">
   <div class="layui-row">    {include file="public/user_left_nav"}

    <div class="userCon layui-col-md10  layui-col-space20">
        <div class="fly-panel fly-panel-user" pad20>
            <div class="layui-tab layui-tab-brief" lay-filter="user">
                <ul class="layui-tab-title" id="LAY_mine">
                    <li class="layui-this" lay-id="info">{$title}</li>
                </ul>
                <div class="layui-tab-content" style="padding: 20px 0;">


                    <div class="layui-form layui-form-pane layui-tab-item layui-show">
                        <table id="demo" lay-filter="test"></table>
                    </div>

                </div>

            </div>
        </div>
    </div>

    </div>
</div>

{include file="public/footer"}

<script>
    //Demo
    var table,form;
    layui.use(['form','table'], function(){
        form = layui.form;
        table = layui.table;
        //第一个实例
        table.render({
            elem: '#demo'
            ,height: 312
            ,url: '{:url("news/index")}' //数据接口
            ,page: true //开启分页
            ,cols: [[ //表头
                {field: 'id', title: 'ID', width:60, sort: true, fixed: 'left'}
                ,{field: 'info', title: '详情',width:620}
                ,{field: 'create_time', title: '发布时间',width:120,}
                ,{field: 'option', title: '操作',width:120,templet: '#titleTpl'}
            ]]
        });
    });

    function del(id) {
        var url="{:url('news/delete')}";
        layer.confirm('确定要删除此记录么？', {
            btn: ['确定','取消'] //按钮
        }, function(){
            $.post(url,{id:id},function (e) {
                if(e.code == 200){
                    success(e.msg);
                    setTimeout("location.reload()",1000)
                }else {
                    error(e.msg)
                }
            })
        }, function(){
            layer.msg('已取消');
        });

    }


</script>

<script type="text/html" id="titleTpl">
    <a href="javascript:;" onclick="del({{d.id}})" class="layui-btn layui-btn-xs  layui-btn-danger">删除</a>
</script>
